package com.agan.rocket.controller;

import com.agan.rocket.constant.SystemConstant;
import com.agan.rocket.service.MyProducer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author weicj
 * @since 2025.01.24
 */

@RestController
@RequestMapping("/rocket")
public class MyController {

    @Resource
    private MyProducer myProducer;

    @GetMapping("/send/{msg}")
    public String send(@PathVariable("msg") String msg){
        myProducer.sendMessage(SystemConstant.TOPIC, msg);
        return "success";
    }
}
